home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 2000 November: Tool Chest / Dev.CD Nov 00 TC Disk 2.toast / pc / sample code / quicktime / quicktimeintro / play movie / start code / pmwindow.c < prev   
Encoding:
C/C++ Source or Header  |  2000-10-06  |  1.4 KB  |  79 lines

  1. /*
  2.     File:        PMWindow.c
  3.     
  4.     Contains:    QuickTime sample code
  5.  
  6.     Copyright:    © 2000 by Apple Computer, Inc. All rights reserved
  7.  
  8.  
  9. */
  10.  
  11. #include "PMWindow.h"
  12.  
  13. //////////
  14. //
  15. // QTFrame_CreateMovieWindow
  16. // Create a new window to display the movie in.
  17. //
  18. //////////
  19.  
  20. WindowReference CreateMovieWindow (void)
  21. {
  22.     WindowReference            myWindow = NULL;
  23.     WindowObject            myWindowObject = NULL;
  24.     
  25. // Insert NewCWindow.clp here...        
  26.  
  27.  
  28.     // create a new window object associated with the new window
  29.     QTFrame_CreateWindowObject(myWindow);
  30.  
  31.     return(myWindow);
  32. }
  33.  
  34. //////////
  35. //
  36. // QTFrame_SizeWindowToMovie
  37. // Set the window size to exactly fit the movie and controller (if visible).
  38. //
  39. //////////
  40.  
  41. void SizeWindowToMovie (WindowObject theWindowObject)
  42. {
  43.     Rect                    myMovieBounds;
  44.     Movie                    myMovie = NULL;
  45.  
  46. #if TARGET_OS_WIN32
  47.     gWeAreSizingWindow = true;
  48. #endif
  49.  
  50.     if (theWindowObject == NULL)
  51.         goto bail;
  52.     
  53.     myMovie = (**theWindowObject).fMovie;
  54.  
  55.     if (myMovie == NULL)
  56.         return;
  57.  
  58. // Step 1.
  59. // Insert Get and Set MovieBox.clp here...
  60.  
  61.     
  62.     // make sure that the movie has a non-zero width;
  63.     // a zero height is okay (for example, with a music movie with no controller bar)
  64.     if (myMovieBounds.right - myMovieBounds.left == 0) {
  65.         myMovieBounds.left = 0;
  66.         myMovieBounds.right = QTFrame_GetWindowWidth((**theWindowObject).fWindow);
  67.     }
  68.  
  69. // Step 2.
  70. // Insert SizeWindow.clp here...
  71.  
  72.  
  73. bail:                                        
  74. #if TARGET_OS_WIN32
  75.     gWeAreSizingWindow = false;
  76. #endif
  77.  
  78.     return;
  79. }